package gaml.java.serializer;

import gaml.error.GamlException;
import gaml.java.ClassSerializer;
import gaml.yaml.ScalarNode;
import gaml.yaml.YamlNode;
import gaml.yaml.ahchor.YamlAnchorCodeStore;
import gaml.yaml.ahchor.YamlAnchorObjectStore;


/**
 * serialize-deserialize instance of Object class
 * actualy, do nothing about him
 * @author shnireck
 *
 */
public class ObjectSerializer implements ClassSerializer <Object> {

	@Override
	public YamlNode createNode (YamlNode parent) { return new ScalarNode (parent); }

	@Override
	public Object createObject () throws GamlException { return null; }

	@Override
	public Object restore (YamlNode node, Object object, YamlAnchorCodeStore anchors) throws GamlException { return object; }

	@Override
	public Class <Object> getObjectClass () { return Object.class; }

	@Override
	public boolean noAnchor () { return true; }

	@Override
	public YamlNode serialize (YamlNode node, Object object, YamlAnchorObjectStore anchors) throws GamlException { return node; }

}
